package org.nowcoder.leetcode.twoPointers;

/**
 * Title  : 392. Is Subsequence
 * Source : https://leetcode.cn/problems/is-subsequence/?envType=study-plan-v2&envId=top-interview-150
 * Author : XrazYang
 * Date   : 2023-07-10
 */

public class LeetCode_392 {
    public boolean isSubsequence(String s, String t) {
        int k = 0;
        for (int i = 0; i < s.length(); i++) {
            for (; k < t.length(); k++) {
                if (s.charAt(i) == t.charAt(k)) {
                    break;
                }
            }
            if (k == t.length()) {
                return false;
            }
            k++;
        }
        return true;
    }
}
